<!DOCTYPE html>
<html>
<head>
<title>电影票配置管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<#include "../../../include/resources.html">
<script type="text/javascript">
	var dataGrid;
	var winWidth = 500;
	var winHeight = 250;
	var addTitle = "添加";
	var addUrl =  "/modules/system/movieConfig/movieConfigAddPage.html";
	var editTitle = "编辑";
	var editUrl =  "/modules/system/movieConfig/movieConfigEditPage.html";
	var addWinParmeters = "'{0}','"+addTitle+"',"+winWidth+","+winHeight+",'"+addUrl+"'";
	$(function() {
		var editIndex = undefined;
		dataGrid = $('#dataGrid').datagrid({
			url : 'movieConfigList.html',
			fit : true,
            fitColumns : true,
			border : false,
			pagination : true,
			idField : 'id',
			pageSize : pageSize,
			pageNums :1,
			pageList : pageList,
			sortName : 'id',
			sortOrder : 'asc',
			checkOnSelect : false,
			selectOnCheck : false,
			nowrap : false,
			singleSelect:true,
				
			columns : [ [ 
				{ field: 'id', title: '编号', width: 50, checkbox : false},
				{ field: 'name', title: '电影名', width: 100, sortable:false},
				{ field: 'price', title: '票价', width: 60, sortable:true},
				{ field: 'sellAcount', title: '已售数量', width: 100, sortable:false},
				{ field: 'updateTime', title: '修改时间', width: 150, fixed:true,sortable:false, 
	          	  	formatter: function(value,row,index){
	          	  		return getLocalTime(value,4);
					  	}
	            },
				{ field : 'action',
					title : '操作',
					width :50,
					fixed:true,
					formatter : function(value, row, index) {
						var str = '';
						str += '<a href="javascript:void(0);" onclick="$.fn.dataGridOptions.editFun('+row.id+',editTitle,winWidth,winHeight,editUrl);" title="'+editTitle+'">编辑</a>';
						return str;
					}
				} 
			] ],
			toolbar : '#toolbar'
		});
	});

	function getIndexAfterDel(){  
	    var selected = $('#dataGrid').datagrid('getSelected');  
	    var index = $('#dataGrid').datagrid('getRowIndex', selected);  
	    return index;  
	} 
	function saverow(index,obj){
		var tmpIndex = getIndexAfterDel();    
		$('#dataGrid').datagrid('endEdit', index);  
	    var node = $('#dataGrid').datagrid('getSelected');  
	    var json = {};  
	    json.id = node.id;  
	    json.nid = node.nid;  
	    json.name = node.name;
	    json.value = node.value;
	    json.status = node.status;  
	    $.ajax({  
            url:'/modules/system/movieConfig/movieConfigEdit.html?id=' + (new Date()).getTime(),  
            type : 'post',  
            data : json, 
            dataType : 'json',  
            timeout : 60000,  
            success : function(data, textStatus, jqXHR) {     
				if (data.result){  
                   	$.messager.alert('提示', '保存成功！', function() {  
                    	$('#dataGrid').datagrid('reload');  
                    });  
             	 }else{
             		$.messager.alert('提示', '保存失败！');
             	 } 
  
            }  
        });  
	}
</script>
</head>
<body style="padding:0 20px;" >
	<div class="easyui-layout" data-options="fit : true,border : false">
		<div data-options="region:'north',border:false,collapsible:false" id="searchBox">
        	<div class="sLeft">
	            <form id="searchForm">
	            	<input type="text" name="searchName" autocomplete="off" class="sInput" placeholder="输入电影名进行搜索" onkeydown="if(event.keyCode == 13){ $.fn.dataGridOptions.searchFun('#searchForm');return false;}"/><a href="javascript:;" title="查询" class="sBtn" onclick="$.fn.dataGridOptions.searchFun('#searchForm');">查询</a>
	            	<a href="javascript:void(0);" class="reloadIcon" onclick="dataGrid.datagrid('reload');" title="刷新" ><i class="iconfont">&#xe603;</i></a>
	            </form>
            </div>
           <div class="sRight">
				<a onclick="$.fn.dataGridOptions.addFun(-1,addTitle,winWidth,winHeight,addUrl);" href="javascript:void(0);" class="addBtn"><i class="iconfont">&#xe629;</i>添加</a>					
            </div>
		</div>
		<div data-options="region:'center'" style="margin-top:30px;padding-bottom:30px;">
			<table id="dataGrid"></table>
		</div>
	</div>
</body>
</html>
